<style>
    .pbutton{cursor:pointer}
</style>
<?
$page = isset($_GET['page'])?$_GET['page']:1;
$page_count = ($record_count%$page_size==0)?($record_count/$page_size): (intval($record_count/$page_size) + 1);
$pre_page = ($page - 1) < 1 ? 1 : ($page - 1);
$next_page = ($page + 1) > $page_count ? $page_count : ($page + 1);
$gets = $_GET;array_remove($gets, 'page');
?>

<?foreach($gets as $key=>$value):?>
    <input type="hidden" name="{key}" value="{value}"/>
<?endforeach;?>
<input type="hidden" name="page" value="{page}"/>

<div id="list_page">
    <div class="digg">
        <?php if($page==1):?>
            <span class="disabled">上一页</span>
        <?php else:?>
            <a class="pbutton" p='{pre_page}'>上一页</a>
        <?php endif;?>
        <?php for($i=(($page-3)<1?1:($page-3));$i<=(($page+3)>$page_count?$page_count:($page+3));$i++){?>
            <?php if($page==$i):?>
                <span class="current">{i}</span>
            <?php else:?>
                <a class="pbutton" p='{i}'>{i}</a>
            <?php endif;?>
        <?php }?>
        <?php if($page==$page_count || $page_count==0):?>
            <span class="disabled">下一页</span>
        <?php else:?>
            <a class="pbutton" p='{next_page}'>下一页</a>
        <?php endif;?>
    </div>
</div>


<!--div class="more2">
	<a class="pbutton" p='1'>
		<img src="images/more1.jpg">
	</a>
	<a class="pbutton" p='{pre_page}'>
		<img src="images/more2.jpg">
	</a>

	<? for($i=(($page-2)<1?1:($page-2));$i<=(($page+2)>$page_count?$page_count:($page+2));$i++){?>
	<a class="pbutton" p='<?php echo $i;?>'><?php echo ($page==$i)?"<font color='red'>$i</font>":$i;?></a>
	<? }?>
	<a class="pbutton" p='{next_page}'>
		<img src="images/more3.jpg">
	</a>
	<a class="pbutton" p='{page_count}'>
		<img src="images/more4.jpg">
	</a>
</div-->

<script>
$(document).ready(function(){
	$('.more2').css('cursor','pointer');
	$('.pbutton').click(function(){
		$('input[name=page]').val($(this).attr('p'));
		$(".listform").submit(); 
	});
	$('.opt select').change(function(){
		$('input[name=page]').val($(this).val());
		$("#list_form").submit(); 
	});
})
</script>